package com.cellulam.framework.core.enums;

import com.cellulam.framework.core.utils.EnumHelper;
import lombok.Getter;

/**
 * 时间单位
 */
@Getter
public enum PeriodUnit implements CodeDescriptionFeature {

    YEAR(1, "年"),
    SEASON(2, "季度"),
    MONTH(3, "个月"),
    WEEK(4, "周"),
    DAY(5, "天"),
    HOUR(6, "小时"),
    MINUTE(7, "分钟"),
    SECOND(8, "秒"),

    ;

    private final int code;
    private final String description;

    PeriodUnit(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static PeriodUnit valueOf(Integer code) {
        return EnumHelper.valueOf(code, PeriodUnit.class);
    }
}
